import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  generateBuildId: () => Date.now().toString(),
  async headers(){
    return [
      {
        source: '/_next/static/(.*)',
        headers: [
          {
            key: 'Cache-Control',
            value: 'public, max-age=31536000, immutable',
          },
        ],
      },
      {
        source: '/',
        headers: [
          {
            key: 'Cache-Control',
            value: 'no-cache, no-store, must-revalidate',
          },
        ],
      },
    ];
  },
  /* config options here */
  async rewrites() {
    return {
      fallback: [
        {
          source: "/api/:path*", // 客户端请求路径
          destination: "http://localhost:3000/:path*", // 实际后端接口地址
        },
      ],
    };
  },
};

export default nextConfig;
